//
//  Reigst.m
//  EcmDoctor
//
//  Created by Mac on 16/2/17.
//  Copyright © 2016年 张进. All rights reserved.
//

#import "Reigst.h"
#import "NetWorkUtil.h"
#import <SSKeychain/SSKeychain.h>
#import "AppUtils.h"
@implementation Reigst
//- (NSString*)description{
// 
//    return [NSString stringWithFormat:@"%@\n%@\n%@",self.code,self.msg,self.data];
//}


+ (void)registWithUsername:(NSString *)username Password:(NSString *)password And:(NSString*)activate_code success:(void (^)( Reigst*))success failure:(void (^)(NSError *))failure {
    
    NetWorkBaseRequest *req = [[NetWorkBaseRequest alloc] init];
    //请求参数
    
    req.moduleName = @"DoctorRS";
    req.methodName = @"Activate";
    [req setValue:username forKey:@"username"];
    [req setValue:password forKey:@"password"];
    [req setValue:activate_code forKey:@"activate_code"];
    [NetWorkUtil requestWithPOST:req success:^(NetWorkBaseResponse *responseObject) {
      
        Reigst *regist= [[Reigst  alloc]init];
        if (responseObject.code.integerValue == 1) {
            
            regist.code=@"1";
           
            
        } else{
            regist.code=@"0";
            regist.msg=responseObject.msg;
           
        }
         success(regist);
    } failure:^(NSError *error) {
        failure(error);
        
    } cache:NO];
    
}

@end
